using System;
using System.Collections;

using Microsoft.DirectX.Direct3D;
using Microsoft.DirectX;




namespace iDorm
{
	// Room
	//
	// Represents the dorm room
	public class Room
	{
		// Priavte data members
		float width, length;

		// Objects within room
		ArrayList objects;

		Model floor;
		Model walls;

		Matrix matFloor;
		Matrix matWalls;





		// Default constructor
		//
		// Description:	initializes the room class with the default settings
		// Input:		None
		// Output:		None
		public Room(float length, float width, Device dev)
		{
			this.width = width;
			this.length = length;

			objects = new ArrayList();

			matFloor = Matrix.Scaling(length, 0.01f, width);
			matWalls = Matrix.Scaling(length, 7.0f, width);
		}


		// Change Room size
		// Description: Change the dimensions of the room when room type is adjusted
		// Input: Length and Width
		// Output: New Room Layout
		public void ChangeRoomSize(float length, float width)
		{
			this.length = length;
			this.width = width;
			matFloor = Matrix.Scaling(length, 0.01f, width);
			matWalls = Matrix.Scaling(length, 7.0f, width);


		}
		// Add Object
		//
		// Description:	adds object to room
		// Input:		Object
		// Output:		None
		public void AddObject(Object obj)
		{
			objects.Add(obj);
		}

		// Remove Object
		//
		// Description:	removes object from room
		// Input:		Object
		// Output:		None
		public void RemoveObject(Object obj)
		{
			objects.Remove(obj);
		}
		// Returns all objects on screen
		public ArrayList GetObjects()
		{
			return objects;
		}

		//attaches to models to room
		public void AttachFloor(Model m)
		{
			floor = m;
		}
		

		// Attaches the wall mesh to the room
		public void AttachWalls(Model m)
		{
			walls = m;
		}





		//Renders the room
		public void RenderRoom(Device dev)
		{
			// Render the floor
			floor.Render(matFloor);
			walls.Render(matWalls);
			


			// Render the objects in the room
			foreach (Object o in objects)
			{
				o.Render();
			}
		}
		// Returns Width
		public float GetWidth()
		{
			return width;
		}
		//Returns length
		public float GetLength()
		{
			return length;
		}


		
	}
}
